define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'other.income/index',
        add_url: 'other.income/add',
        edit_url: 'other.income/edit',
        delete_url: 'other.income/delete',
        export_url: 'other.income/export',
        modify_url: 'other.income/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh',
                    [{
                        text: '添加',
                        url: init.add_url,
                        method: 'open',
                        auth: 'add',
                        class: 'layui-btn layui-btn-normal layui-btn-sm',
                        icon: 'fa fa-plus ',
                        extend: 'data-width="650px" data-height="360px"',
                    }], 'export'],
                cols: [[
                    {type: 'checkbox', hide: true},
                    {field: 'id', title: '编号', width: 100},
                    {field: 'amount', title: '金额'},
                    {field: 'description', title: '备注', search: false},
                    {field: 'create_time', title: '创建时间', search: 'range'},
                    {
                        width: 120,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '编辑',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success',
                                extend: 'data-width="650px" data-height="360px"',
                            }]
                        ]
                    }

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});